<?php
	class MemLog {
		private $template_log = "template_log.xml";
		
		
		public function gravarLog($info, $action, $error='', $user='public', $system='indefinido'){
			$xml = file_get_contents($this->template_log);
			$info = str_replace("'", "\'", $info);
			$info = str_replace('"', '\"', $info);
			$search = array("date_replace", "action_replace", "info_replace", "user_replace", "system_replace", "error_replace");
			$replace = array(" ".date("d/m/Y H:i:s")." ", " ".$action." ", $info, " ".$user." ", " ".$system." ", " ".$error." ");
			$xml = str_replace($search, $replace, $xml);
			$flog = fopen($this->log_path,'a');
			fwrite($flog, $xml);
			fclose($flog);
		}
	}
?>